package com.manager.cms.service.impl;

import com.github.pagehelper.PageHelper;
import com.manager.cms.bo.ExpressMan;
import com.manager.cms.common.Pageable;
import com.manager.cms.mapper.ExpressManMapper;
import com.manager.cms.service.ExpressManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 * @author 
 * @version v1.0
 * @date 2020-05-19
 */
@Service
public class ExpressManServiceImpl implements ExpressManService {

    @Autowired
    private ExpressManMapper expressManMapper;

    @Override
    public void insert(ExpressMan record) {
        expressManMapper.insert(record);
    }

    @Override
    public void update(ExpressMan record){
        expressManMapper.update(record);
    }

    @Override
    public void del(String id){
        expressManMapper.del(id);
    }

    @Override
    public ExpressMan selectByPrimaryKey(String id){
        return expressManMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<ExpressMan> getList(ExpressMan record){
        return expressManMapper.selectByRecord(record);
    }

    @Override
    public Pageable<ExpressMan> pageList(ExpressMan record, Integer pageNum, Integer pageSize){
        Integer count = expressManMapper.countByRecord(record);
        PageHelper.startPage(pageNum, pageSize);
        List<ExpressMan> list = expressManMapper.selectByRecord(record);
        return new Pageable<>(list, count, pageSize, pageNum);
    }

}